﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace CPPProject.Migrations
{
    public partial class UpdateCPPPart : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<long>(
                name: "ForCompanyId",
                table: "CPPPart",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "PType",
                table: "CPPPart",
                maxLength: 10,
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_CPPPart_ForCompanyId",
                table: "CPPPart",
                column: "ForCompanyId");

            migrationBuilder.AddForeignKey(
                name: "FK_CPPPart_CPPCompany_ForCompanyId",
                table: "CPPPart",
                column: "ForCompanyId",
                principalTable: "CPPCompany",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_CPPPart_CPPCompany_ForCompanyId",
                table: "CPPPart");

            migrationBuilder.DropIndex(
                name: "IX_CPPPart_ForCompanyId",
                table: "CPPPart");

            migrationBuilder.DropColumn(
                name: "ForCompanyId",
                table: "CPPPart");

            migrationBuilder.DropColumn(
                name: "PType",
                table: "CPPPart");
        }
    }
}
